<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>修改蛋糕</title>
    <link rel="stylesheet" type="text/css" href="css/index.css"/>
</head>
<body>
<jsp:include page="menu.jsp"/>
<div class="index-content">
    <div class="index-content-operation">
        <a class="info-detail">修改蛋糕</a>
        <br>
        <br>
    </div>
    <br>
    <form action="shangpingEdit" method="post" onsubmit="return check()">
        <input type="hidden" id="id" name="id" value="${vo.id}"/>
        
        <table class="index-content-table-add">
            <tr>
                <td width="12%">名称：</td><td><input class="index-content-table-td-add" type="text" id="shangpingName" name="shangpingName" value="${vo.shangpingName}"/></td>
            </tr>
            <tr>
                <td width="12%">介绍：</td><td><textarea id="shangpingText" name="shangpingText" style="width: 60%; height: 100px;padding: 0px 17px;" placeholder="请输入内容......">${vo.shangpingText}</textarea></td>
            </tr>
            <tr>
                <td width="12%">价格：</td><td><input class="index-content-table-td-add" type="text" id="shangpingJiage" name="shangpingJiage" value="${vo.shangpingJiage}"/></td>
            </tr>
            <tr>
                <td width="12%">类目：</td><td><input class="index-content-table-td-add" type="text" id="shangpingLeimu" name="shangpingLeimu" value="${vo.shangpingLeimu}"/></td>
            </tr>
        </table>
        <br>
        <br>
        <br>
        &nbsp;&nbsp;&nbsp;<button type="submit" class="btn btn-line btn-rect btn-danger btn-sm">提交</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button type="button" class="btn btn-line btn-rect btn-warning btn-sm" onclick="javascript:history.back(-1);">取消</button>
    </form>
</div>

</body>
<script type="text/javascript">
    //提交之前进行检查，如果return false，则不允许提交
    function check() {
        //根据ID获取值
        if (document.getElementById("shangpingName").value.trim().length == 0) {
            alert("名称不能为空!");
            return false;
        }
        if (document.getElementById("shangpingJiage").value.trim().length == 0) {
            alert("价格不能为空!");
            return false;
        }
        if (document.getElementById("shangpingLeimu").value.trim().length == 0) {
            alert("类目不能为空!");
            return false;
        }
        return true;
    }
</script>
</html>
